using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class SO_PICK_BATCHMap : EntityTypeConfiguration<SO_PICK_BATCH>
    {
        public SO_PICK_BATCHMap()
        {
            // Primary Key
            this.HasKey(t => t.Origin);

            // Properties
            this.Property(t => t.Batch)
                .HasMaxLength(10);

            this.Property(t => t.Period)
                .HasMaxLength(4);

            this.Property(t => t.Origin)
                .IsRequired()
                .HasMaxLength(2);

            // Table & Column Mappings
            this.ToTable("SO_PICK_BATCH");
            this.Property(t => t.Batch).HasColumnName("Batch");
            this.Property(t => t.Period).HasColumnName("Period");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.Origin).HasColumnName("Origin");
        }
    }
}
